package com.lyt.springboot.designPattern.strategyPattern;

// 测试策略模式
public class StrategyPatternDemo {
    public static void main(String[] args) {
        // 创建上下文并设置Post转发策略
        ForwardingContext context = new ForwardingContext(new PostForwardingStrategy());
        context.forwardMessage("Hello, this is a test message for Post!");

        // 动态改变策略为MQ转发
        context.setStrategy(new MQForwardingStrategy());
        context.forwardMessage("Hello, this is a test message for MQ!");
    }
}